package cn.icanci.loopstack.bic.sdk.properties;

import cn.icanci.loopstack.bic.sdk.system.SystemConstant;

import java.util.StringJoiner;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 配置规则说明
 *
 * @author icanci
 * @since 1.0 Created in 2023/08/19 12:03
 */
@Component
@ConfigurationProperties(prefix = "bic")
public class BicProperties {
    /**
     * 系统标识
     */
    private String  systemKey;
    /**
     * 同步写
     */
    private boolean synchronous;
    /**
     * bic服务端地址
     */
    private String  bicServerUrl;
    /**
     * 单次请求最大批量写提交条数
     */
    private long    maxBatchSize       = SystemConstant.DEFAULT_MAX_BATCH_SIZE;
    /**
     * 最大批量写提交时间 毫秒
     */
    private long    maxBatchSubmitTime = SystemConstant.DEFAULT_MAX_BATCH_SUBMIT_TIME;

    public String getSystemKey() {
        return systemKey;
    }

    public void setSystemKey(String systemKey) {
        this.systemKey = systemKey;
    }

    public boolean isSynchronous() {
        return synchronous;
    }

    public void setSynchronous(boolean synchronous) {
        this.synchronous = synchronous;
    }

    public String getBicServerUrl() {
        return bicServerUrl;
    }

    public void setBicServerUrl(String bicServerUrl) {
        this.bicServerUrl = bicServerUrl;
    }

    public long getMaxBatchSize() {
        return maxBatchSize;
    }

    public void setMaxBatchSize(long maxBatchSize) {
        this.maxBatchSize = maxBatchSize;
    }

    public long getMaxBatchSubmitTime() {
        return maxBatchSubmitTime;
    }

    public void setMaxBatchSubmitTime(long maxBatchSubmitTime) {
        this.maxBatchSubmitTime = maxBatchSubmitTime;
    }

    @Override
    public String toString() {
        return new StringJoiner(",").add("systemKey=" + systemKey).add("synchronous=" + synchronous).add("bicServerUrl=" + bicServerUrl).add("maxBatchSize=" + maxBatchSize)
            .add("maxBatchSubmitTime=" + maxBatchSubmitTime).toString();
    }
}
